﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MapInfo_CarList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Bind(0);
            Bind2(0);
        }
    }

    public void ListPageContral1_PageSizeChange(int pageSize, int PageIndex)
    {
        Bind(PageIndex);
    }

    private void Bind(int PageIndex)
    { 
        if(Request["DepartmentID"]==null)
            return ;
        string DepartmentID=Request["DepartmentID"];
        List<Yipusoft.MapInfo.Model.DepartmentCarInfo> list = Yipusoft.MapInfo.BLL.DepartmentCar.GetList("DepartmentID='" + DepartmentID + "'");
        List<Yipusoft.MapInfo.Model.DepartmentCarInfo> list2= Yipusoft.MapInfo.BLL.DepartmentCar.GetPhotoByDepartmentID("DepartmentID='" + DepartmentID + "'", "ID", "ASC", 6, PageIndex);
        this.DltList.DataSource = list2;
        this.ListPageContral1.ItemCount = list.Count;
        this.DltList.DataBind();
    }

    private void Bind2(int PageIndex)
    { 
        if(Request["DepartmentID"]==null)
            return ;
        string DepartmentID=Request["DepartmentID"];

        this.DltList2.DataSource = Yipusoft.Vehicle.BLL.Vehicle.GetList(6,PageIndex,"DepartmentID='" + DepartmentID + "'");
        this.ListPageContral2.ItemCount = Yipusoft.Vehicle.BLL.Vehicle.GetCount("DepartmentID='" + DepartmentID + "'");
        this.DltList2.DataBind();
    }

    public void ListPageContral2_PageSizeChange(int pageSize, int PageIndex)
    {
        Bind2(PageIndex);
    }
    public string GetPic(object obj)
    {
        if (obj == null||obj.ToString().Trim()=="")
            return "/Images/none.jpg";
        else
            return obj.ToString();
    }

     public string GetPic1(object obj)
    {
        if (obj == null||obj.ToString().Trim()=="")
            return "/Images/none.jpg";
        else
            return "/BasicBase/Vehicle/pics/"+obj.ToString();
    }
    


}
